<?php

use yii\helpers\Html;
use yii\widgets\DetailView;

/* @var $this yii\web\View */
/* @var $model backend\modules\home\models\Qikan */

$this->title = $model->title;
$this->params['breadcrumbs'][] = ['label' => 'Qikans', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="qikan-view">
    <p>
        <?= Html::a('编辑', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
        <?= Html::a('删除', ['delete', 'id' => $model->id], [
            'class' => 'btn btn-danger',
            'data' => [
                'confirm' => 'Are you sure you want to delete this item?',
                'method' => 'post',
            ],
        ]) ?>
        <?= Html::a('封面图片上传', ['upload', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
    </p>
    <style>
        th{width:120px}
    </style>
    <div class="row">
        <div class="col-md-8" style="overflow: hidden">
            <?= DetailView::widget([
                'model' => $model,
                'attributes' => [
                    'id',
                    'title',
                    'intro:ntext',
                    'order',
                    'image_path',
                    'keyword',
                    'desc',
                    'content:ntext',
                    [
                        'format' => 'raw',
                        'attribute' => 'status',
                        'value' => function($model) {
                            if($model->status == 1){
                                return '<span class="btn btn-success btn-xs">发布中</span>';
                            }else{
                                return '<span class="btn btn-success btn-xs">未发布</span>';
                            }
                        },
                    ],
                    [
                        'format' => 'raw',
                        'attribute' => 'created_at',
                        'value' => function($model) {
                            return date('Y-m-d H:i:s', $model->created_at);
                        },
                    ],
                    [
                        'format' => 'raw',
                        'attribute' => 'updated_at',
                        'value' => function($model) {
                            return date('Y-m-d H:i:s', $model->updated_at);
                        },
                    ],
                ],
            ]) ?>
        </div>

        <div class="col-md-4">
            <img src="<?=$model->image_path?>" alt="" style="width:50%">
        </div>
    </div>


</div>
